<template>
	<view class="list">
		<!--社区公告列表-->
		<view v-if="notice_list!==null && notice_list.length==0">
			<u-empty text="无数据" mode="list"></u-empty>
		</view>
		<u-cell-group title="社区公告列表">
			<u-cell-item icon="volume-up" v-for="(item, index) in notice_list" :key="index" :title="item.title" :value="item.date" @click="to_form(item)"></u-cell-item>
		</u-cell-group>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//公告列表
				notice_list: []
			}
		},
		onLoad() {
			this.loadNoticeList();
		},
		methods: {
			loadNoticeList: function() {
				let _self = this;
				_self.$serverData.app_notice_list(_self, null, function(res) {
					_self.notice_list = res.data.data;
				});
			},
			//跳转至详情页面
			to_form: function(item){
				this.$routerTo.page('./notice_form?item='+encodeURIComponent(JSON.stringify(item)))
			}
		},
	}
</script>

<style>
	.list {
		margin-top: 5rpx;
		margin-left: auto;
		margin-right: auto;
	}
</style>
